// const http = require('http');
// const server = http.createServer();
// server.on('request',(req,res) =>{
//     res.end('hello');
// });
// server.listen(8080);



console.log("hello world");

const http = require("http");
/** 引入一个原生模块 http
 * http2 = http + 2.0 加密传输
 * https = http + SSL 加密传输
 * nodejs开发环境自带的模块称为原生模块
 */

// http.createServer(() => {

// })

let server = http.createServer((req,res) => {
    res.end("hello node,request")
})
/**
 * createServer(requestListener(req,res) => {
 *  
 * })
 * req是客户端发过来的请求信息的封装对象
 * res是对客户端响应信息的封装对象
 * 
 */

server.listen(8080)
console.log("server is listening 8080");